import axios from '../../js/axios'
import Api from '../../api'
const state = {
  login: {}
}
const actions = {
  async getLogin ({ commit }, params) {
    const data = await axios.post(Api.login, params)
    const { code, msg } = data
    if (code === 0) {
      commit('login', data)
    } else {
      return msg
    }
  }
}
const mutations = {
  login (state, data) {
    state.login = data
  }
}
export default {
  namespaced: true,
  state,
  actions,
  mutations
}
